package tuan.score;

import java.util.*; 

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class ImgUrlScore extends NodeScore {
	static Set<String> suffixSet = new HashSet<String>();
	static {
		suffixSet.add("jpg");
		suffixSet.add("jpeg");
		suffixSet.add("png");
		suffixSet.add("bmp");
		suffixSet.add("gif");
	}
	double score ;
	public ImgUrlScore(double score) throws Exception {
		this.score = score;
	}

	@Override
	protected double getScore(Node node) {
		double defaultScore = 0.0 ;
		if (node.hasAttributes()) {
			NamedNodeMap attrNodeList = node.getAttributes();
			if (attrNodeList.getNamedItem("src") != null) {
				return getUrlScore(attrNodeList.getNamedItem("src").getNodeValue());
			}				
		}
		return defaultScore;
	}
	protected double getUrlScore(String url) {
		return 0.0;
	}
}
